package ms.maplestory.boot.connection.opcode;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum InHeader {

    CP_CheckPassword(1),
    CP_WorldInfoRequest(4),
    CP_SelectWorld(5),
    CP_CheckUserLimit(6),
    CP_CheckPinCode(9),
    CP_UpdatePinCode(10),
    CP_WorldRequest(11),
    CP_LogoutWorld(12),
    CP_ViewAllChar(13),
    CP_MigrateIn(20),
    CP_CheckDuplicatedID(21),
    CP_CreateNewCharacter(22),
    CP_EnableSPWRequest(28),
    CP_CheckSPWRequest(29),
    CP_ClientDumpLog(36),
    CP_None(999);

    private short opcode;
    private final static Map<Short, InHeader> opToHeaderMap = new HashMap<>();

    static {
        for (InHeader ih : values()) {
            opToHeaderMap.put(ih.getOpcode(), ih);
        }
    }

    InHeader(int opcode) {
        this.opcode = (short) opcode;
    }

    public short getOpcode() {
        return opcode;
    }

    public static InHeader getInHeaderByOp(int op) {
        return opToHeaderMap.getOrDefault((short) op, null);
    }

    private static List<InHeader> spam = Arrays.asList(

    );

    public static boolean isSpamHeader(InHeader inHeaderByOp) {
        return spam.contains(inHeaderByOp);
    }
}